﻿@model LoginViewModel

<div class="login-page">
    <div class="page-header">
        <h1>Login</h1>
    </div>

    <partial name="_ValidationSummary" />

    <div class="row">

        @if (Model.EnableLocalLogin)
        {
            <form asp-route="authorize" class="form login-container">
                <div class="col-sm-6">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">Local Login</h3>
                        </div>
                        <div class="panel-body">

                            <form asp-route="Login">
                                <input type="hidden" asp-for="ReturnUrl" />

                                <fieldset>
                                    <div class="form-group">
                                        <label asp-for="Username"></label>
                                        <input class="form-control" placeholder="Username" asp-for="Username" autofocus>
                                    </div>
                                    <div class="form-group">
                                        <label asp-for="Password"></label>
                                        <input type="password" class="form-control" placeholder="Password" asp-for="Password" autocomplete="off">
                                    </div>
                                    @if (Model.AllowRememberLogin)
                                    {
                                        <div class="form-group login-remember">
                                            <label asp-for="RememberLogin">
                                                <input asp-for="RememberLogin">
                                                <strong>Remember My Login</strong>
                                            </label>
                                        </div>
                                    }
                                    <div class="form-group">
                                        <button type="submit" class="btn btn-primary" name="button" value="login">登录</button>
                                        <button class="btn btn-default" name="button" value="cancel">取消</button>
                                        <button class="btn btn-default" name="button" asp-controller="Account" asp-action="Register">注册账号</button>
                                    </div>
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </form>
        }

        @if (Model.VisibleExternalProviders.Any())
        {
            <div class="col-md-6 col-sm-6 external-providers">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">External Login</h3>
                    </div>
                    <div class="panel-body">
                        <ul class="list-inline">
                            @foreach (var provider in Model.VisibleExternalProviders)
                            {
                                <li>
                                    <a class="btn btn-default"
                                       asp-controller="External"
                                       asp-action="Challenge"
                                       asp-route-provider="@provider.AuthenticationScheme"
                                       asp-route-returnUrl="@Model.ReturnUrl">
                                        @provider.DisplayName
                                    </a>
                                </li>
                            }
                        </ul>
                    </div>
                </div>
            </div>
        }

        @if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
        {
            <div class="alert alert-warning">
                <strong>Invalid login request</strong>
                There are no login schemes configured for this client.
            </div>
        }
    </div>
</div>